-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate from Terser and Babel to SWC #6920
Conversation
Any change to sizes? |
Also is there a difference in ECMA compliance, if there is a difference between ES5 versio s, and what it results in? |
It has the same targets for both UMD and ES builds, so should match current
outputs.
I need to adjust some settings to get the build size back in line though,
so consider this draft for now.
…On Fri, 6 Sep 2024 at 18:15, mrmaxm ***@***.***> wrote:
Also is there a difference in ECMA compliance, if there is a difference
between ES5 versio s, and what it results in?
—
Reply to this email directly, view it on GitHub
<#6920 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADJFLFPULMRTOP2IBLJDHTZVHPLDAVCNFSM6AAAAABNY3P7G2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZUGQ4TGNBTGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
If it is not possible to bring the build size to what terser is capable of, then we can consider to use this for a debug build, as it is usually the one that takes the most of the time during development and its size is of less importance. |
Below are the file sizes. Will continue investigating
|
The wins from this look extremely compelling. I'd be supportive of switching. |
- Added "peer": true to several existing dependencies to indicate peer dependencies. - Introduced new modules: jackspeak (v3.4.3) and package-json-from-dist (v1.0.1) with their respective details. - Added path-scurry (v1.11.1) and its dependency lru-cache (v10.4.3) with funding information. These changes enhance dependency management and ensure compatibility with peer dependencies.
- Eliminated the babel-parser dependency from the ESLint configuration file. - Updated the parser options to ensure compatibility with the existing setup. These changes streamline the ESLint configuration and reduce unnecessary dependencies.
- Changed the import name of the SWC plugin from 'swc' to 'swcPlugin' for clarity. - Updated all instances in the buildTarget function to use the new import name. These changes improve code readability and maintainability.
- Removed several unused Babel-related dependencies from package.json and package-lock.json to streamline the project. - Updated the package-lock.json to reflect the removal of these dependencies and added optional flags where applicable. - Enhanced dependency management by ensuring that only necessary modules are retained, improving overall project maintainability.
… rollup-spaces-to-tabs.mjs - Deleted the rollup-script-target.mjs file, streamlining the build process. - Updated swcOptions to ensure comments are preserved in the output when not minifying. - Clarified documentation in rollup-spaces-to-tabs.mjs regarding the plugin's functionality. These changes enhance code maintainability and improve the clarity of the build configuration.
…s for Rollup. See vitejs/vite#15532 - Added optional dependencies for various Rollup packages, including support for multiple platforms (Linux, Darwin, FreeBSD, Windows). - Updated package-lock.json to reflect the addition of these optional dependencies and their respective versions. - This change enhances cross-platform compatibility and ensures that the build process can leverage the appropriate Rollup binaries as needed.
…lated dependencies - Upgraded @swc/core to version 1.10.1 and updated its dependencies across various platforms. - Removed the optional dependency for @rollup/rollup-linux-x64-gnu. - Updated @swc/types to version 0.1.17 for improved compatibility. - These changes enhance the project's build capabilities and ensure better support for the latest SWC features.
Comparison of Existing Build System vs SWC
Observations
|
- Removed the parserOptions.requireConfigFile setting from the ESLint configuration.
…, and include several new devDependencies - Removed the deprecated @napi-rs/canvas dependency from package.json and package-lock.json. - Added canvas version 3.0.1 to both files. - Introduced multiple new development dependencies, enhancing the project's capabilities and ensuring compatibility with the latest features.
I've stumbled upon this ticket at rollup: It seems they use SWC since version 4.x. Which means, we are already using it indirectly. Is the speedup coming from dropping Babel+Terser? |
This is just for internally parsing the AST in Rollup. It still relies on external plugins such as @rollup/plugin-babel for transpiling/lowering/minifying the final output. Previously we were using terser for minifying and babel for transpiling which are both JS implementations. SWC is Rust, so it's a lot faster and handles both transpiling and minifying. |
- Upgraded the @swc/core dependency from version 1.10.1 to 1.10.4 in both package.json and package-lock.json to ensure compatibility with the latest features and improvements.
- Eliminated the skipLibCheck option from the TypeScript configuration to enforce stricter type checking and improve code quality.
This PR replaces Babel + Terser with SWC which improves the build time of each target.
The same ES5 targets are used for UMD build outputs.
With Terser/Babel ~ 1m40s
With SWC ~ 51s
I confirm I have read the contributing guidelines and signed the Contributor License Agreement.